{extend name="public/common"/}
{block name="head"}

{/block}

{block name="banner"}

<div class="banner">
    <div class="wrapper">
        <div class="txt">
            {$category.title}
        </div>
    </div>
</div>
{/block}
{block name="body"}
{include file="document/nav"/}

<div class="wrapper ">
    <div class="paynotice">
        <div class="body" style="min-height:300px">
            <form>
                <input type="hidden" name="page" id="page" value="1">
                <ul id="lists" >
                    {Cms:document name="document" category_id="$category['id']" row="5"}
                    <li>
                        <i>
                            {eq name='key' value='0'}
                            <img src="__IMG__/ico_07.png"/>
                            {/eq}
                           </i>
                        <a  href="{:url('cms/Document/detail?category_id='.$document['category_id'],['id'=>$document['id']])}" title="{$document.title}">{$document.title}</a>
                        <span>{$document.create_time}</span>
                    </li>
                    {/Cms:document}
                </ul>
            </form>
        </div>
        <div class="foot" id="getmore">
            <a class="g-btn" href="javascript:;">加载更多</a>
        </div>
    </div>
</div>
{/block}


{block name="script"}
<script type="text/javascript">
    $("#getmore").click(function(){
        var page = $("#page").val();
        $.ajax({
            type: "get",
            dataType: "json",
            url: "{:url('cms/Document/lists?category_id='.$category['id'])}",
            data: {pageCurrent:parseInt(page) + 1,more:1},
            success: function(result) {
                if(0 == result.code && result.data.data.length>0) {
                    var str = "";
                    $.each(result.data.data,function(index,array){
                            str += '<li>';
                            str +=  '<a href="{:url(\'index/Document/detail\',[],false,false)}/'+array['id']+'.html">'+array['title']+'</a>';
                            str += '<span>'+array['create_time']+'</span>';
                            str += '</li>';
                            str += '<i>';
                    });
                    $("#lists").append(str);
                    if (result.data.current_page >= result.data.last_page)
                    {
                        $("#getmore").html("没有更多内容了..");
                    }
                    $("#page").val(result.data.current_page);
                } else {
                    $("#getmore").html("没有更多内容了..");
                }
            }
        });
    });
</script>
{/block}
